import sys
import traceback


def idle(g=None):
    if g is None:
        g = {}
    print("=" * 15, "idle", "=" * 15)
    while True:
        code = input(">>> ")
        if code == 'quit':
            break
        try:
            print(eval(code, g))
        except Exception:  # noqa
            traceback.print_exc(file=sys.stdout)
    print("=" * 12, "out of idle", "=" * 11)
